
/******************************************************************************\
|    Title:        	 FIGUREF3: Average marginal effects of being a switcher on  |
|					 unweighted lobbying revenue, by year since leaving Congress|
|    Date:         	 July 2023	                                         	   |
|    Author:         Elisa Wirsching	      							       |
\******************************************************************************/


clear all
set more off, permanently
numlabel, add
set maxvar 32000


use lobbyist_yearly.dta, clear

* regression
reg log_adjlobrev i.switcher##i.yearsinceleaving experience_imp daysworked committeestaff_everyear personalstaff_everyear senate_everyear majority_everyear minority_everyear dcoffice_everyear leaderofficestaff_everyear log_max_adjannual_pay i.year if posttreat==1, cluster(stafferid)

* plot marginal effects
margins if yearsinceleaving<8, dydx(i.switcher) over(i.yearsinceleaving)

marginsplot, plotopts(connect(none) mcolor(black) lcolor(black)) graphregion(color(white)) yline(0, lcolor(black)) recastci(rspike) ciopts(lcolor(black)) ytitle("Effect estimate for being a switcher") title("") xtitle("Year since leaving Congress") 


